MAPPING

Section: SOS CLASS LIBRARY (3S)
Updated: 28/10/1991
Index Return to Main Contents
man2html: unable to open or read file /usr/lib/ms/ms.acc
 

NAME

Mapping<Key, Info> - predefined class Mapping  

SYNOPSIS

#include "<SOS>/include/agg_sos.h"

class Mapping<Key,Info> (sos_Bool list_cursor = FALSE,
                        sos_Bool key_based_on_equal = FALSE,
                        sos_Bool info_based_on_equal = FALSE)
   : Association<Key, Info> (key_based_on_equal, info_based_on_equal)
{
public:
   sos_Bool     is_key (Key);
   sos_Bool     is_info (Info);
   void         insert (Key, Info);
   void         remove (Key);
   Info         operator[] (Key);

   // ** sos_Cursor operations **
   Key          get_key (sos_Cursor);
   Info         get_info (sos_Cursor);
   void         set_info (sos_Cursor, Info);
   void         move_cursor (sos_Cursor, Key);
   void         insert_before (sos_Cursor, Key, Info);
   void         insert_after (sos_Cursor, Key, Info);
}
 

DESCRIPTION

The class Mapping<Key,Info> provides means for manipulating generic Mappings. The type of the keys and the type of the infos is stated when the Mapping type is instantiated. A mapping may be looked upon as a function m: Key ---> Info. (Methods that overwrite inherited methods are only described in the superclass, where they are inherited from - provided that they are semantically equivalent).

Mapping::create (ct, list_cursor, key_based_on_equal, info_based_on_equal)
The create parameters key_based_on_equal and info_based_on_equal determine if tests for membership in the Mapping should be based on the equality or identity of the respective entities, as in superclass Association. The additional parameter list_cursor decides, whether the Mapping may dynamically be modified while a cursor iterates over the structure. If list_cursor ==FALSE, and modifying operations are performed on a Mapping during a scan with a sos_Cursor, then the behavior of sos_Cursor operations after the modification is undefined. On the other hand, a Mapping that is created with list_cursor == TRUE will require a bit more of persistent memory.
is_key (k)
returns TRUE if some info is associated with the key k, FALSE otherwise.
is_info (i)
returns TRUE if i is associated with some key, FALSE otherwise.
insert (k, i)
associates an info i with the given key k. If there is an info already associated with that key, it is replaced by the given info --- and the key remains unchanged.
remove (k)
deletes the entry associated with key k from the Mapping, if such an entry exists.
operator[] (k)
returns the info associated with the given key k if such an entry exists, otherwise it returns NO_OBJECT.

The following methods require an open sos_Cursor(3) as input parameter:

get_key (c)
returns the key associated with the current position of sos_Cursor c.

PRECONDITION: self.is_valid (c)

get_info (c)
returns the info associated with the current position of sos_Cursor c.

PRECONDITION: self.is_valid (c)

set_info (c, i)
sets the info associated with the current position of sos_Cursor c to i.

PRECONDITION: self.is_valid (c)

move_cursor (c, k)
repositions the cursor c to an entry with the given key k.

PRECONDITION: c.defined_for (self)

insert_before (c, k, i)
This function may be used as the insert (k, i) operation, but it guarantees that after an application of the to_pred (c) operation on the Mapping, self.get (c) will return the new member.

PRECONDITION: self.is_valid (c)

insert_after (c, k, i)
This function may be used as the insert (k, i) operation, but it guarantees that after an application of the to_succ (c) operation on the Mapping, self.get (c) will return the new member.

PRECONDITION: self.is_valid (c)

 

FILES

<SOS>/src/agg/agg.sos
SOS schema file

<SOS>/src/agg/agg_sos.h
complete schema interface

<SOS>/src/agg/agg_use.h
restricted schema interface

<SOS>/src/agg/agg_ext.h
definition of iterators (automatically included by agg_use.h)

<SOS>/src/agg/Mapping.c
Mapping implementation file

<SOS>/lib/sos.a
SOS library
 

SEE_ALSO

sos_Object(3), sos_Aggregate(3), Association(3), sos_Cursor(3)  

AUTHOR

Bernhard Schiefer, Dietmar Theobald


 

Index

NAME
SYNOPSIS
DESCRIPTION
FILES
SEE_ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 00:37:57 GMT, March 30, 2022